package com.ddtech.framework.system.model;

import com.ddtech.models.AbstractModel;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.validator.constraints.Length;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;

/**
* @author Apache License
* @date 2019-03-29
*/
@Entity
@Data
@Table(name="sys_job")
public class SysJob extends AbstractModel {
    /**
     * 名称
     */
    @Column(name = "name",nullable = false)
    @NotBlank
    @Length(max=70,message = "名称长度超过最大限制")
    private String name;

    @Column(unique = true)
    @NotNull
    private Long sort;

    /**
     * 状态
     */
    @Column(name = "enabled",nullable = false)
    @NotNull
    private Boolean enabled;

    @OneToOne
    @JoinColumn(name = "dept_id")
    private SysDept dept;

    /**
     * 创建日期
     */
    @Column(name = "create_time")
    @CreationTimestamp
    private Timestamp createTime;

    public @interface Update {}
}
